

package MagnetoProject;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

/**
 *
 * @author ken
 */
public class Storage {

    static ArrayList<String> xData = new ArrayList<String>();
    static ArrayList<String> yData = new ArrayList<String>();
    static ArrayList<String> magnitudeData = new ArrayList<String>();

    private static int numDataX = 0;
    private static int numDataY = 0;

    private List _listeners = new ArrayList();
    static DisplayArea display = new DisplayArea();

    public Storage(){

    
    }


    public static void addX(String input){
        xData.add(input);
        numDataX++;
        System.out.println("X array pos: " + numDataX);
        
    }

    public static void addY(String input){
        yData.add(input);
        numDataY++;
        System.out.println("Y array pos: " + numDataY);
    }

    public static String getX(){
        String string = xData.get(numDataX-1);
        xData.remove(numDataX-1);
        numDataX--;
        return string;
       }

    public static String getY(){
        String string = yData.get(numDataY-1);
        yData.remove(numDataY-1);
        numDataY--;
        return string;
    }



    public static int getNumData(){

        
            return numDataX;
    }

    public static void print(){

        System.out.println(xData.get(numDataX-1));
    }

    // public synchronized void addStorageListener( StorageListener l ) {
  //      _listeners.add( l );
 //   }


   // public synchronized void fireStorageEvent() {
   //     StorageEvent storage = new StorageEvent( this );
    //    Iterator listeners = _listeners.iterator();
    //    while( listeners.hasNext() ) {
     //       ( (StorageListener) listeners.next() ).dataReceived( storage );
    //    }
  //  }



}
